var SubCreateRoomWindow = CreateRoomWindow.extend({
    _ccsFileName: res.CreateRoomWindow_json,

    _handleSpecialDepend:function(){
        CreateRoomWindow.prototype._handleSpecialDepend.call(this);
        var del40Card = this._cbList['del40Card_0'];//随机删除40张牌
        var liangrenwan = this._cbList['liangrenwan_0'];//随机删除40张牌
        if ((liangrenwan && liangrenwan.getChildByName('checkBox').isSelected())) {
            if (del40Card) del40Card.setVisible(true);
        } else {
            if (del40Card) del40Card.setVisible(false);
        }

        this._handleChangShaZhuaMa();
        this._handleChangShaQueyimen();//却一门
        this._handleZhuanzhuanZhuaMa();
        this._Hunzhuo();
    },
    _Hunzhuo: function(){
        var mapid = this._cbList['mapid_1'];
        if (!mapid) {
            return;
        }
        var mapidCb = mapid.getChildByName('checkBox');
        if (!mapidCb) {
            return;
        }

        var del40Card = this._cbList['del40Card_0'];//随机删除40张牌
        var liangrenwan = this._cbList['liangrenwan_0'];//随机删除40张牌
        var wanjiarenshu0 = this._cbList['wanjiarenshu0_0'];//随机删除40张牌
        var queyise = this._cbList['queyise_0'];//缺一门
        if (this._clubId && gameData.useNewClub) {
            if ((wanjiarenshu0 && wanjiarenshu0.getChildByName('checkBox').isSelected())) {
                if (del40Card) del40Card.setVisible(true);
            } else {
                if (del40Card) del40Card.setVisible(false);
            }
        }else {
            queyise.setVisible(liangrenwan && liangrenwan.getChildByName('checkBox').isSelected() && mapidCb.isSelected());
            if ((liangrenwan && liangrenwan.getChildByName('checkBox').isSelected())) {
                if (del40Card) del40Card.setVisible(true);
            } else {
                if (del40Card) del40Card.setVisible(false);
            }
        }

        var wanjiarenshu0_0 = this._cbList['wanjiarenshu0_0'];
        var wanjiarenshu1_0 = this._cbList['wanjiarenshu1_0'];
        var wanjiarenshu2_0 = this._cbList['wanjiarenshu2_0'];
        if (this._clubId) {
            var siren_0 = this._cbList['siren_0'];
            if (siren_0) siren_0.setVisible(false);
            var sanrenwan_0 = this._cbList['sanrenwan_0'];
            if (sanrenwan_0) sanrenwan_0.setVisible(false);
            var liangrenwan_0 = this._cbList['liangrenwan_0'];
            if (liangrenwan_0) liangrenwan_0.setVisible(false);

            if (wanjiarenshu0_0){
                wanjiarenshu0_0.setVisible(true);
                var posX_0 = wanjiarenshu0_0.getPositionX(); // 分包更新兼容
                if(posX_0 > 2000) wanjiarenshu0_0.setPositionX(posX_0 - 2000);
            }
            if (wanjiarenshu1_0) {
                wanjiarenshu1_0.setVisible(true);
                var posX_1 = wanjiarenshu1_0.getPositionX();
                if(posX_1 > 2000) wanjiarenshu1_0.setPositionX(posX_1 - 2000);
            }
            if (wanjiarenshu2_0) {
                wanjiarenshu2_0.setVisible(true);
                var posX_2 = wanjiarenshu2_0.getPositionX();
                if(posX_2 > 2000) wanjiarenshu2_0.setPositionX(posX_2 - 2000);
            }
        } else {
            if (wanjiarenshu0_0) wanjiarenshu0_0.setVisible(false);
            if (wanjiarenshu1_0) wanjiarenshu1_0.setVisible(false);
            if (wanjiarenshu2_0) wanjiarenshu2_0.setVisible(false);
        }
    },
    /*

     */
    _handleChangShaQueyimen: function(){
        var mapid = this._cbList['mapid_1'];
        if (!mapid) {
            return;
        }
        var mapidUserData = mapid.getUserData();
        if (!mapidUserData) {
            return;
        }
        if (mapidUserData.val != app.map_id.CHANGSHA) {
            return;
        }
        var mapidCb = mapid.getChildByName('checkBox');
        if (!mapidCb) {
            return;
        }
        if (!mapidCb.isSelected()){
            return;
        }
        //缺一门
        var queyise = this._cbList['queyise_0'];//缺一门
        var jintongyunv = this._cbList['jintongyunv_0'];
        var santong = this._cbList['santong_0'];
        var liangrenwan = this._cbList['liangrenwan_0'];//随机删除40张牌
        var queyiseCheck = queyise.getChildByName('checkBox');
        var liangrenwanCheck = liangrenwan.getChildByName('checkBox');
        if (this._clubId && gameData.useNewClub) {
        }else {
            jintongyunv.setVisible(!(liangrenwanCheck.isSelected() && queyiseCheck.isSelected()));
            santong.setVisible(!(liangrenwanCheck.isSelected() && queyiseCheck.isSelected()));
        }
    },
    /**
     * 处理长沙麻将的抓码
     */
    _handleChangShaZhuaMa: function () {
        // 长沙麻将
        var mapid = this._cbList['mapid_1'];
        if (!mapid) {
            return;
        }
        var mapidUserData = mapid.getUserData();
        if (!mapidUserData) {
            return;
        }
        if (mapidUserData.val != app.map_id.CHANGSHA) {
            return;
        }
        var mapidCb = mapid.getChildByName('checkBox');
        if (!mapidCb) {
            return;
        }
        if (!mapidCb.isSelected()){
            return;
        }
        // 抓码文字
        var zhuamaWz = this._nodeList['word_zm'];
        if (!zhuamaWz) {
            return;
        }
        // 抓码1个（翻倍时候用）
        var zhua1 = this._cbList['zhaniao_csfanbei_0'];
        if (!zhua1) {
            return;
        }
        var zhua1Cb = zhua1.getChildByName('checkBox');
        if (!zhua1Cb) {
            return;
        }
        // 抓码2，4，6 不翻倍时候
        var zhua2 = this._cbList['zhaniao_cs_0'];
        var zhua4 = this._cbList['zhaniao_cs_1'];
        var zhua6 = this._cbList['zhaniao_cs_2'];
        if (!zhua2 || !zhua4 || !zhua6) {
            return;
        }
        var zhua2Cb = zhua2.getChildByName('checkBox');
        var zhua4Cb = zhua4.getChildByName('checkBox');
        var zhua6Cb = zhua6.getChildByName('checkBox');
        if (!zhua2Cb || !zhua4Cb || !zhua6Cb) {
            return;
        }
        // 抓码翻倍
        var zhuanFbNode = this._cbList['zhongniaofanbei_0'];
        if (!zhuanFbNode) {
            return;
        }
        var zhuanFbCb = zhuanFbNode.getChildByName('checkBox');
        if (!zhuanFbCb) {
            return;
        }
        // 不抓码
        var buzhuama = this._cbList['buzhuama_0'];
        if (!buzhuama) {
            return;
        }
        var buzhuamaCb = buzhuama.getChildByName('checkBox');
        if (!buzhuamaCb) {
            return;
        }
        // 经典抓码
        var zhuamajingdian = this._cbList['zhuamajingdian_0'];
        if (!zhuamajingdian) {
            return;
        }
        var zhuamajingdianCb = zhuamajingdian.getChildByName('checkBox');
        if (!zhuamajingdianCb) {
            return;
        }
        // 159抓码
        var zhuama159 = this._cbList['zhuama159_0'];
        if (!zhuama159) {
            return;
        }
        var zhuama159Cb = zhuama159.getChildByName('checkBox');
        if (!zhuama159Cb) {
            return;
        }
        // 如果选中的是不抓码
        if (buzhuamaCb.isSelected()) {
            zhuamaWz.setVisible(false);
            zhua1.setVisible(false);
            zhua2.setVisible(false);
            zhua4.setVisible(false);
            zhua6.setVisible(false);
            zhuanFbNode.setVisible(false);
            return;
        }
        // 如果选中的是经典抓码
        if (zhuamajingdianCb.isSelected()) {
            zhuamaWz.setVisible(true);
            zhuanFbNode.setVisible(true);
            zhua1.setVisible(zhuanFbCb.isSelected());
            zhua2.setVisible(!zhuanFbCb.isSelected());
            zhua4.setVisible(!zhuanFbCb.isSelected());
            zhua6.setVisible(!zhuanFbCb.isSelected());
            return;
        }
        // 如果选中的是159抓码
        if (zhuama159Cb.isSelected()) {
            zhuamaWz.setVisible(true);
            zhua1.setVisible(false);
            zhua2.setVisible(true);
            zhua4.setVisible(true);
            zhua6.setVisible(true);
            zhuanFbNode.setVisible(false);
        }
    },
    /**
     * 处理转转麻将的抓码  2人玩没抓麻
     */
    _handleZhuanzhuanZhuaMa: function () {
        // 长沙麻将
        var mapid = this._cbList['mapid_0'];
        if (!mapid) {
            return;
        }
        var mapidUserData = mapid.getUserData();
        if (!mapidUserData) {
            return;
        }
        if (mapidUserData.val != app.map_id.ZHUANZHUAN) {
            return;
        }
        var mapidCb = mapid.getChildByName('checkBox');
        if (!mapidCb) {
            return;
        }
        if (!mapidCb.isSelected()) {
            return;
        }
        // 抓码文字
        var zhuamaWz = this._nodeList['word_zm'];
        if (!zhuamaWz) {
            return;
        }
        // 抓码2，4，6 不翻倍时候
        var hongzhong = this._cbList['hongzhong_0'];
        if (!hongzhong) {
            return;
        }
        //两人玩
        var liangrenwan = this._cbList['liangrenwan_0'];
        var liangrenwanCb = liangrenwan.getChildByName('checkBox');
        if (!liangrenwanCb) {
            return;
        }
        // 如果选中的是不抓码
        if (liangrenwanCb.isSelected() && !this._clubId) {
            hongzhong.setVisible(false);
        }else{
            hongzhong.setVisible(true);
        }
    },
});